 <!--
* description: 计划制定
* author: wangml
* createdDate: 2020-11-30
-->
<template>
  <section class="cartypeQuery">
    <el-dialog
      id="cartypeq"
      v-dialogDrag
      :title="dynamicTextMap[dialogStatus]"
      :visible.sync="popupsVisible"
      width="50%"
      center
      :append-to-body="true"
      :lock-scroll="true"
      :before-close="handleClose"
    >
      <dialogHeader
        slot="title"
        :title="dynamicTextMap[dialogStatus]"
        :style-type="$store.state.app.dialogType"
      />
      <el-row :gutter="20">
        <el-col :span="6">
          <el-button
            v-if="dialogStatus === 'headquarters'
              ||dialogStatus === 'hqEdit'
              ||dialogStatus === 'weekPlan'"

            class="unsuccessbtn"
            type="primary"
            icon="el-icon-search"
            @click="unsuccessOrderQuery"
          >未配车客户订单查询
          </el-button>
        </el-col>
      </el-row>
      <template
        v-for="comps in dialogStatus === 'headquarters'
          || dialogStatus === 'hqEdit'
          || dialogStatus === 'weekPlan'
          ? coms1 : coms"
      >
        <div :key="comps.tid" class="filter-container filter-params">
          <h3 v-if="comps.title" :style="styleObj">{{ comps.title }}</h3>
          <el-row ref="vailComponentList1" :gutter="26">
            <component
              :is="comp.component"
              v-for="comp in comps.data.filter(o => o.isMust === true)"
              :ref="comp.isRequire ? comp.isRequire+ comp.compKey : comp.compKey"
              :key="comp.compKey"
              :validrule="comp.validrule"
              :code-field="comp.codeField"
              :text-field="comp.textField"
              :popups-key="comp.compKey"
              :code="formField[comp.codeField]"
              :disabled="comp.disabled"
              :is-require="comp.isRequire"
              :start-time="comp.startTime"
              :is-mul="comp.isMul"
              :span="comp.span || 24"
              :format="comp.format"
              :label-width="comp.lw"
              :label-name="comp.labelName"
              :lookuptype="comp.lookuptype"
              :date-type="comp.dateType"
              :parent-fileds="comp.parentFileds"
              :data-to-object="comp.dataToObj"
              :date-options-type="comp.dateOptionsType"
              :custom-obj="comp.customObj"
              :options="comp.options"
              :o-fields="comp.oFields"
              :cb="comp.cb"
              @changeCode="getComponentCode"
              @focusCode="getFocusCode"
            />
          </el-row>
        </div>
      </template>
      <el-divider />
      <div slot="footer" class="dialog-footer">
        <el-button size="mini" type="primary" icon="iconfont  icon-confirm" :loading="btnloading" @click="sendCode">保存 </el-button>
        <!-- 确认 -->
        <el-button size="mini" @click="handleClose">取消 </el-button>
        <el-button size="mini" @click="reset">清除 </el-button>
      </div>
    </el-dialog>
  </section>
</template>
<script>

import Vue from 'vue'
import { formMixins } from '@/components/mixins/formMixins'
import api from '@/api/planReport'
import { orgApis } from '@/api/vesalesapi'

export default {
  name: 'CarTypeSimple',
  components: {
    lableName: () => import('@/components/lableName'), // 标题溢出样式组件
    dialogHeader: () => import('@/components/dialogHeader') // 弹窗标题,
  },
  mixins: [formMixins],
  props: {
    // eslint-disable-next-line vue/require-valid-default-prop
    dynamicTextMap: { type: Object, default: () => (
      { headquarters: '总部月计划制定',
        hqEdit: '总部月计划编辑',
        stores: '门店月计划制定',
        storesEdit: '门店月计划编辑',
        weekPlan: '总部周计划制定',
        weekPlanEdit: '总部周计划编辑'
      }) },
    popupsState: { type: String, default: 'add' },
    dialogStatus: { type: String, default: 'headquarters' },

    popupsVisible: { type: Boolean, default: false },
    code: { type: String, default: '' },
    comType: { type: String, default: '' },
    codeField: { type: String, default: '' },
    popupsKey: { type: String, default: '' },
    isMul: { type: Boolean, default: true },
    validrule: {
      type: Object,
      default: () => {}
    }
  },
  beforeRouteEnter(to, from, next) {
    Vue.prototype.$ConfigCache.CacheConfig.initData(
      // 同时加载当前页面和编辑框页面的配置
      [to.path, ''],
      function() {
        next()
      })
  },
  data() {
    const viewPageCode = this.$route.path
    // 绑定事件配置化事件
    this.$ConfigCache.CacheConfig.bindEvent(this, [viewPageCode])
    return {
      btnloading: false,
      // 上限
      CeilingNum: '',
      // 下限
      FloorNum: '',
      apiUrl: '',
      // apiStyle: 'restful',
      // ruleSettingShow: false,
      // h3标题行内样式
      valid: false,
      tableComponents: [],
      genCodeFiled: null,
      styleObj: { borderLeft: null },
      coms: [
        {
          // title: '保险费发票',
          tid: 1,
          data: [ // 门店提报
            {
              compKey: 'compKey1',
              labelName: '制定月份：',
              codeField: 'makingMonth',
              component: () => import('@/components/org/datePicker/datePicker.vue'),
              dateType: 'month',
              format: 'yyyy-MM',
              dateOptionsType: '3',
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'planMonthComp',
              labelName: '计划月份：',
              codeField: 'planMonth',
              component: () => import('./datePicker.vue'),
              dateType: 'month',
              format: 'yyyy-MM',
              disabled: true,
              parentFileds: 'disabled:makingMonth-planMonth--false',
              dateOptionsType: '3',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compkey4',
              labelName: '计划周度：',
              codeField: 'planWeek',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              oFields: 'planWeek,planWeek',
              options: [],
              parentFileds: 'disabled:planMonth-planWeek--false',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carSeries',
              labelName: '车系名称：',
              codeField: 'carSeriesId',
              textField: 'carSeriesCn',
              oFields: 'carSeriesId,carSeriesCn',
              customObj: { api: orgApis.listOfCarSeries, selectType: '1' },
              component: () => import('@/components/org/commonSelect'),
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carConfig',
              labelName: '基础车型名称：',
              codeField: 'carConfigId',
              textField: 'carConfigCn',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              oFields: 'carConfigId,carConfigCn',
              parentFileds: 'value:carSeriesId,disabled:carSeriesId-carConfigId--false',
              customObj: {
                listQuery: { carSeriesId: '' },
                api: orgApis.listOfCarModel, selectType: '1'
              },
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'optionalPag',
              labelName: '选装包：',
              codeField: 'optionalPagId',
              textField: 'optionalPagName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId,disabled:carConfigId-optionalPagId--false',
              oFields: 'optionalPagId,optionalPagName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: ''
                },
                api: orgApis.listOfPackage, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carColor',
              labelName: '车身颜色：',
              codeField: 'carColorId',
              textField: 'carColorName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId|optionalPagId,disabled:optionalPagId-carColorId--false',
              oFields: 'carColorId,carColorName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: '', optionalPagId: ''
                },
                api: orgApis.listOfCarColor, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carIncolor',
              labelName: '内饰颜色：',
              codeField: 'carIncolorId',
              textField: 'carIncolorName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId|optionalPagId,disabled:optionalPagId-carIncolorId--false',
              oFields: 'carIncolorId,carIncolorName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: '', optionalPagId: ''
                },
                api: orgApis.listOfCarInterior, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            // {
            //   compKey: 'compKey2',
            //   labelName: '车型选配器：',
            //   codeField: 'ttCode',
            //   component: () => import('@/components/org/carTypeSimple'),
            //   type: 'dropdownList',
            //   isMust: true,
            //   isRequire: true
            // },
            {
              compKey: 'compKey2',
              labelName: '车型选配器：',
              codeField: 'ttCode',
              disabled: true,
              component: () => import('@/components/org/commonInput'),
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compkey5',
              labelName: '数量',
              codeField: 'planNum',
              component: () => import('@/components/org/commonInput'),
              // type: 'inputtxt',
              isMust: true,
              validrule: {
                isInteger: true
              },
              isRequire: true
            },
            {
              compKey: 'compkey6',
              labelName: '优先级别',
              codeField: 'priorityLevel',
              component: () => import('@/components/org/commonSelect'),
              lookuptype: 'VE1227',
              isMust: true,
              isRequire: true
            }
          ]
        }
      ],
      coms1: [
        {
          // title: '保险费发票',
          tid: 1,
          data: [ // 总部提报
            {
              compKey: 'compKey1',
              labelName: '制定月份：',
              codeField: 'makingMonth',
              component: () => import('@/components/org/datePicker/datePicker.vue'),
              dateType: 'month',
              format: 'yyyy-MM',
              dateOptionsType: '3',
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'planMonthComp',
              labelName: '计划月份：',
              codeField: 'planMonth',
              component: () => import('./datePicker.vue'),
              dateType: 'month',
              format: 'yyyy-MM',
              startTime: '',
              dateOptionsType: '3',
              disabled: true,
              parentFileds: 'disabled:makingMonth-planMonth--false',
              type: 'inputTxt',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compkey4',
              labelName: '计划周度：',
              codeField: 'planWeek',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              oFields: 'planWeek,planWeek',
              options: [],
              isMust: true,
              isRequire: true,
              parentFileds: 'disabled:planMonth-planWeek--false'
              // validrule: {
              //   noRequire: false,
              //   isformat: /^[wW][0-5]?[0-9]$/
              // }
            },
            {
              compKey: 'carSeries',
              labelName: '车系名称：',
              codeField: 'carSeriesId',
              textField: 'carSeriesCn',
              oFields: 'carSeriesId,carSeriesCn',
              customObj: { api: orgApis.listOfCarSeries, selectType: '1' },
              component: () => import('@/components/org/commonSelect'),
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carConfig',
              labelName: '基础车型名称：',
              codeField: 'carConfigId',
              textField: 'carConfigCn',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              oFields: 'carConfigId,carConfigCn',
              parentFileds: 'value:carSeriesId,disabled:carSeriesId-carConfigId--false',
              customObj: {
                listQuery: { carSeriesId: '' },
                api: orgApis.listOfCarModel, selectType: '1'
              },
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'optionalPag',
              labelName: '选装包：',
              codeField: 'optionalPagId',
              textField: 'optionalPagName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId,disabled:carConfigId-optionalPagId--false',
              oFields: 'optionalPagId,optionalPagName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: ''
                },
                api: orgApis.listOfPackage, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carColor',
              labelName: '车身颜色：',
              codeField: 'carColorId',
              textField: 'carColorName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId|optionalPagId,disabled:optionalPagId-carColorId--false',
              oFields: 'carColorId,carColorName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: '', optionalPagId: ''
                },
                api: orgApis.listOfCarColor, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'carIncolor',
              labelName: '内饰颜色：',
              codeField: 'carIncolorId',
              textField: 'carIncolorName',
              disabled: true,
              component: () => import('@/components/org/commonSelect'),
              parentFileds: 'value:carConfigId|carSeriesId|optionalPagId,disabled:optionalPagId-carIncolorId--false',
              oFields: 'carIncolorId,carIncolorName',
              customObj: {
                listQuery: {
                  carConfigId: '', carSeriesId: '', optionalPagId: ''
                },
                api: orgApis.listOfCarInterior, selectType: '1'
              },
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            // {
            //   compKey: 'compKey2',
            //   labelName: '车型选配器：',
            //   codeField: 'ttCode',
            //   component: () => import('@/components/org/carTypeSimple'),
            //   type: 'dropdownList',
            //   isMust: true,
            //   isRequire: true
            // },
            {
              compKey: 'compKey2',
              labelName: '车型选配器：',
              codeField: 'ttCode',
              disabled: true,
              component: () => import('@/components/org/commonInput'),
              type: 'dropdownList',
              isMust: true,
              isRequire: true
            },
            {
              compKey: 'compkey5',
              labelName: '数量',
              codeField: 'planNum',
              component: () => import('@/components/org/commonInput'),
              isMust: true,
              validrule: {
                isInteger: true
              },
              isRequire: true
            }

          ]
        }
      ],
      curPopupsVisible: this.popupsVisible,
      formField: {
        makingMonth: '',
        planMonth: '',
        planWeek: '',
        carSeriesId: '',
        carSeriesCn: '',
        carConfigId: '',
        carConfigCn: '',
        optionalPagId: '',
        optionalPagName: '',
        carColorId: '',
        carColorName: '',
        carIncolorId: '',
        carIncolorName: '',
        ttCode: '',
        priorityLevel: '',
        planNum: ''
      }
    }
  },
  watch: {
    popupsVisible: {
      handler(newVal) {
        if (newVal) {
          this.$nextTick(() => {
            if (this.popupsState === 'edit') {
              const {
                makingMonth,
                planMonth,
                planWeek,
                carSerId,
                carSeriesCn,
                carSeriesCode,
                carConfigId,
                carConfigCode,
                carConfigCn,
                carOptionalpagId,
                optionalPagName,
                optionalPagCode,
                carColorId,
                carColorName,
                carColorCode,
                carIncolorId,
                carIncolorCode,
                carIncolorName,
                ttCode,
                priorityLevel,
                planNum
              } = this.dynamicEditRowData
              Object.assign(this.formField, {
                makingMonth,
                planMonth,
                planWeek,
                carSeriesId: carSerId,
                carSeriesCn: carSeriesCode + carSeriesCn,
                carConfigId,
                carConfigCn: carConfigCode + carConfigCn,
                optionalPagId: carOptionalpagId,
                optionalPagName: optionalPagCode + optionalPagName,
                carColorId,
                carColorName: carColorCode + carColorName,
                carIncolorId,
                carIncolorName: carIncolorCode + carIncolorName,
                ttCode,
                priorityLevel,
                planNum
              })
            }
          })
        }
      },
      immediate: true
    },
    'formField.planMonth': {
      handler(val) {
        if (val) {
          if (this.dynamicEditRowData.planMonth !== val) {
            this.formField.planWeek = ''
          }
          var thisMonth = val + '-01'
          this.getweekByplan(thisMonth)
        } else {
          this.getPlanWeek()
        }
      }
    },
    'formField.makingMonth': {
      handler(val) {
        if (!val) {
          this.formField.planMonth = ''
        } else {
          // findFloating
          // 有值 动态设置时间禁用
          this.tableComponents.filter(item => item.compKey === 'planMonthComp')[0].startTime = val
        }
      }
    },
    'formField': {
      handler(form) {
        const { carConfigCn, optionalPagName, carColorName, carIncolorName } = form
        if (carConfigCn || optionalPagName || carColorName || carIncolorName) {
          this.formField.ttCode = carConfigCn.slice(0, 13) + optionalPagName.slice(0, 5) + carColorName.slice(0, 3) + carIncolorName.slice(0, 1)
        }
        if (new Date(form.planMonth) <= new Date(form.makingMonth)) {
          this.formField.planMonth = ''
          const comp = this.$refs['trueplanMonthComp'][0]
          comp.modelCode = ''
          this.$alert('计划月份大于制定月份，请重新选择!', '提示', {
            confirmButtonText: '确定'
          }).then(() => {
            comp.$children[0].$children[1].focus()
          })
        }
      },
      deep: true
    }
  },
  created() {
    const coms = (this.dialogStatus === 'headquarters' || this.dialogStatus === 'weekPlan') ? this.coms1 : this.coms
    this.genCodeFiled = this.genUtil(this.tableComponents)
    this.tableComponents = coms.reduce((pre, cur) => [...pre, ...cur.data], [])
  },
  mounted() {
    this.getPlanWeek()
    this.setColor()
  },

  methods: {
    // 获取计划周度
    getweekByplan(planMonth) {
      this.$requestAPI({
        apiUrl: api.weekPlan.APIUrl,
        variables: {
          planMonth: planMonth
        }
      }).then(res => {
        if (res.result === '1') {
          const optionList = []
          var arr = res.rows
          arr.forEach(item => {
            optionList.push({
              planWeek: item.PLAN_WEEK,
              planWeekText: item.PLAN_WEEK
            })
          })
          this.coms[0].data[2].options = optionList
          this.coms1[0].data[2].options = optionList
        } else {
          this.$message(res.msg)
        }
      })
    },
    // 计划周度
    getPlanWeek() {
      const optionList = []
      // const options = this.coms[0].data[2].options
      for (let i = 1; i < 53; i++) {
        const num = i
        optionList.push({
          planWeek: `W${num}`,
          planWeekText: `第${this.rp(num)}周`
        })
      }
      this.coms1[0].data[2].options = optionList
      this.coms[0].data[2].options = optionList
    },
    rp(n) {
      const cnum = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九', '十']
      var s = ''
      n = '' + n // 数字转为字符串
      for (var i = 0; i < n.length; i++) {
        s += cnum[parseInt(n.charAt(i))]
      }
      if (s.length === 2) { // 两位数的时候
        // 如果个位数是0的时候，令改成十
        if (s.charAt(1) === cnum[0]) {
          s = s.charAt(0) + '十'
          // 如果是一十改成十
          if (s === cnum[1] + cnum[10]) {
            s = cnum[10]
          }
        } else if (s.charAt(0) === cnum[1]) {
          // 如果十位数是一的话改成十
          s = cnum[10] + s.charAt(1)
        } else if (s.charAt(0) === cnum[2]) {
          // 如果十位数是二的话改成二十
          s = cnum[2] + cnum[10] + s.charAt(1)
        } else if (s.charAt(0) === cnum[3]) {
          // 如果十位数是三的话改成三十
          s = cnum[3] + cnum[10] + s.charAt(1)
        } else if (s.charAt(0) === cnum[4]) {
          // 如果十位数是四的话改成四十
          s = cnum[4] + cnum[10] + s.charAt(1)
        } else if (s.charAt(0) === cnum[5]) {
          // 如果十位数是五的话改成五十
          s = cnum[5] + cnum[10] + s.charAt(1)
        }
      }
      return s
    },
    onEdit() {

    },
    reset() {
      this.formField.makingMonth = ''
      this.formField.planMonth = ''
      this.formField.planWeek = ''
      this.formField.ttCode = ''
      this.formField.carSeriesId = ''
      this.formField.carSeriesCn = ''
      this.formField.carConfigId = ''
      this.formField.carConfigCn = ''
      this.formField.optionalPagId = ''
      this.formField.optionalPagName = ''
      this.formField.carColorId = ''
      this.formField.carColorName = ''
      this.formField.carIncolorId = ''
      this.formField.carIncolorName = ''
      this.formField.planNum = ''
      this.resetIconV()
    },
    resetIconV() {
      this.$nextTick(() => {
        for (const comp in this.$refs) {
          if (comp.includes('true')) {
            // 隐藏验证图标
            this.$refs[comp][0].$children[0].$children[2].iconV = '3'
          }
        }
      })
    },
    onCreated() {
      if (this.formField === null) {
        this.formField = { carBrandCode: '' }
      }
    },
    // 未插单成功按钮点击事件
    unsuccessOrderQuery() {
      const reg = new RegExp(/^(https?:\/\/[^\/]*)\/(.*)$/)
      // const anchorPoint = (process.env.NODE_ENV === 'development' ? '/#' : '')
      const anchorPoint = '/#'
      const url = reg.exec(window.location.href)[1] + anchorPoint + '/veMgr/veSales/orderNoCar'
      window.open(url)
    },
    // 门店月计划制定&&修改 总部 门店  数量浮动上下限findFloating
    monthPlan(reqData) {
      this.$requestAPI({
        // eslint-disable-next-line no-constant-condition
        apiUrl: this.popupsState === 'add' ? api.storeSalesSubmit.APIUrl
          : api.storeSalesUpdate.APIUrl,
        variables: reqData
      }).then(response => {
        this.btnloading = false
        if (response.result === '1') {
          this.$message(response.msg)
          this.$parent.$refs['multipleTable'].queryTable(1)
          this.$emit('update:popupsVisible', false)
        } else {
          response.msg ? this.$message(response.msg) : this.$message('保存失败！')
        }
      }).catch(err => {
        this.$message(err.response.data.msg)
      })
    },
    sendCode() {
      this.$utils.validataMoth(this, 'validpopup')
      // 发送请求
      if (this.valid) {
        this.btnloading = true
        if (this.dialogStatus === 'stores' || this.dialogStatus === 'storesEdit') {
          // 处理门店计划保存
          const reqData = this.$utils.deepCopy(this.formField)
          reqData['carOptionalpagId'] = reqData['optionalPagId']
          reqData['carSerId'] = reqData['carSeriesId']
          if (this.popupsState === 'edit') {
            reqData['updateControlId'] = this.dynamicEditRowData.updateControlId
          }
          this.monthPlan(reqData)
        } else if (this.dialogStatus === 'weekPlan') {
          const reqData = this.$utils.deepCopy(this.formField)
          reqData['carOptionalpagId'] = reqData['optionalPagId']
          reqData['carSerId'] = reqData['carSeriesId']
          this.$requestAPI({
            // eslint-disable-next-line no-constant-condition
            apiUrl: api.makeHqWeekSalePlan.APIUrl,
            variables: reqData
          }).then(response => {
            this.btnloading = false
            if (response.result === '1') {
              this.$message(response.msg)
              this.$parent.$refs['multipleTable'].queryTable(1)
              this.$emit('update:popupsVisible', false)
            } else {
              response.msg ? this.$message(response.msg) : this.$message('保存失败！')
            }
          }).catch(err => {
            this.btnloading = false
            this.$message(err.response.data.msg)
          })
        } else {
          // 处理总部计划保存
          const reqData = this.$utils.deepCopy(this.formField)
          reqData['carOptionalpagId'] = reqData['optionalPagId']
          reqData['carSerId'] = reqData['carSeriesId']
          delete reqData.priorityLevel
          this.popupsState === 'edit'
            ? reqData['updateControlId'] = this.dynamicEditRowData.updateControlId : ''
          this.$requestAPI({
            // eslint-disable-next-line no-constant-condition
            apiUrl: this.popupsState === 'add'
              ? api.headquartersPlanSubmit.APIUrl
              : api.headquartersPlanUpdate.APIUrl,
            variables: reqData
          }).then(response => {
            this.btnloading = false
            if (response.result === '1') {
              this.$message(response.msg)
              this.$parent.$refs['multipleTable'].queryTable(1)
              this.$emit('update:popupsVisible', false)
            } else {
              response.msg ? this.$message(response.msg) : this.$message('保存失败！')
            }
          }).catch(err => {
            this.btnloading = false
            this.$message(err.response.data.msg)
          })
        }
      }
    },
    genUtil: (array) => (attr) => array.reduce((p, c) => {
      p[c[attr]] = ''
      return p
    }, {}),
    // 设置h3标题颜色
    setColor() {
      const nowSystemColor = this.$store.getters.nowTheme.backgroundColor
      this.styleObj.borderLeft = `5px solid ${nowSystemColor}`
    },

    handleClose() {
      this.$confirm(`确认关闭？`)
        .then(_ => {
          this.$emit('update:popupsVisible', false)
          // eslint-disable-next-line no-undef
          done()
        })
        .catch(_ => {})
    }

  }
}
</script>

<style lang="css" scoped>
  h3 {
    padding-left: 10px;
    text-align: left;
    font-weight: 600;
  }

  h3 button.el-button {
    float: right;
    margin-right: 10px;
  }
  >>> div.el-row:nth-of-type(1) {
    margin-left: 20px;
    margin-bottom: 20px;
  }
  >>> div.el-col.el-col-24 {
    margin-bottom: 13px;
  }
  >>> button.el-button.unsuccessbtn{
    margin-left: 20px;
  }
  .dialog-footer {
    float: right;
  }
  >>>.el-dialog__footer {
    overflow: hidden;
    padding: 10px 24px;
  }
</style>
